import types
import urllib
from django import template

register = template.Library()

@register.filter
def escape_url(value):
    if type(value) is types.UnicodeType:
        return urllib.quote(value.encode("utf-8"))
    else:
        return urllib.quote(value)

